//
//  Emoticon.swift
//  EmojiKeyboard
//
//  Created by ZhangZiang on 15/12/28.
//  Copyright © 2015年 ZhangZiang. All rights reserved.
//

import UIKit

class Emoticon: NSObject {

    //emoji表情对应的十六进制字符串
    var code : String?
    //路径id
    var id : String?
    //服务器表情文本
    var chs : String?
    //本地的替换的表情文件
    var png : String?
    
    var imagePath : String? {
        let path = NSBundle.mainBundle().bundlePath + "/Emoticons.bundle/" + (id ?? "") + "/" + (png ?? "")
        
        return path
    }
    
    //将16进制字符串转换成emoji表情
    var emojiStr : String? {
        if let str = code?.emojiStr() {
            return str
        }
        return nil
    }
    
    //增加是否是 删除/空表情 的标记
    var isEmpty : Bool = false
    var isDelete : Bool = false
    
    init(isEmpty : Bool) {
        super.init()
        self.isEmpty = isEmpty
    }
    init(isDelete : Bool) {
        super.init()
        self.isDelete = isDelete
    }
    
    init(dict : [String : String]) {
        super.init()
        setValuesForKeysWithDictionary(dict)
    }
    
    override func setValue(value: AnyObject?, forUndefinedKey key: String) {
        
    }
    
    override var description : String {
       let keys = ["code","chs","png"]
        return dictionaryWithValuesForKeys(keys).description
    }
}
